package com.easy.api.factory.file.service;

import org.springframework.stereotype.Component;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;


/**
 * @Author liuyuan
 * @Date 2020/5/16 10:41 上午
 * @Version 1.0
 */
@Component("generateExcelService")
public class GenerateExcelService extends HeaderFileTemplate{

    @Override
    public void generateFile() throws FileNotFoundException {
        String render = render(fileModelGenerate.templatePath(), fileModelGenerate.fileName(), templateMap);
        String fileName = getFileName();
        PrintStream printStream= new PrintStream(new FileOutputStream(fileName));//路径默认在项目根目录下
        printStream.println(render);
    }
}
